import request from '@/utils/request'

export function get_tenants() {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/tenant/find'
  })
}

export function save_current_tenant(data) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/tenant/token/save',
    method: 'post',
    data
  })
}

export function get_current_tenant() {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/tenant/token/find'
  })
}

/**
 *
 * @param {string} id 根据页面id 获取当前页面授权资源列表
 */
export function getPrincipleUI(data) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/tenantPrincipleUI/getPrinciplesUI',
    method: 'post',
    data
  })
}

/**
 *
 * @param {string} 根据当前界人员+账套 获取授权路由信息
 */
export function getPrincipleMenu({data,tenantInfo }) {
  return request({
    baseURL: process.env.VUE_APP_ADMIN_API,
    url: '/tenantPrincipleUI/getPrinciplesMenu',
    method: 'post',
    headers: {
      'tenant-account': tenantInfo
    },
    data
  })
}
